#pragma once
#include<iostream>
using namespace std;

class Mutex{
public:
Mutex(pthread_mutex_t * mutex=nullptr):mutex_(mutex){}
void Lock()
{
    if(mutex_)
    {
        pthread_mutex_lock(mutex_);//加锁
    }
    
}

void UnLock()
{
    if(mutex_)
    {
 pthread_mutex_unlock(mutex_);//解锁
    }
   
}
private:
pthread_mutex_t *mutex_;

};

class LockReady
{
    public:
    LockReady(pthread_mutex_t* mutex)
    :mutex_(mutex)
    {
mutex_.Lock();//加锁
    }
    ~LockReady()
    {
        mutex_.UnLock();//解锁
    }
    public:
  Mutex mutex_;
};
